// plant for the inverted pendulum // macro massCart = 2.0; macro lengthRod = 0.5; macro massRod = 0.1; module Plant(hybrid real position, hybrid real velocity, hybrid real angle, hybrid real angularVelocity, hybrid real force) { flow { drv(position) <- cont(velocity); drv(angle) <- cont(angularVelocity); drv(velocity) <- ((cont(force) - massRod * 9.81 * cont(angle)) / massCart); drv(angularVelocity) <- (((massCart + massRod) * 9.81 * cont(angle) - cont(force)) / (massCart * lengthRod)); // to maintain values of variables drv(force) <- 0; } until (false); }